<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>New Relation Requests</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
MathJax = {
	tex: {
		inlineMath: '$', '$'], ['\\(', '\\)'
	},
	svg: {
		fontCache: 'global'
	}
};
</script>
<script type="text/javascript" id="MathJax-script" async
	src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js">
</script>

<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'New Relation Requests' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../inform7n.html">Inform7</a></li><li><a href="index.html">assertions</a></li><li><a href="index.html#3">Chapter 3: Requests</a></li><li><b>New Relation Requests</b></li></ul></div>
<p class="purpose">Special sentences for creating new relations.</p>

<ul class="toc"><li><a href="3-nrr.html#SP7">&#167;7. Creation, Stage II</a></li><li><a href="3-nrr.html#SP7_1">&#167;7.1. The parsing phase</a></li><li><a href="3-nrr.html#SP8">&#167;8. The completion phase</a></li><li><a href="3-nrr.html#SP9">&#167;9. Storing relations</a></li><li><a href="3-nrr.html#SP11">&#167;11. Registering names of relations</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. </b>The following reads sentences like:
</p>

<blockquote>
    <p>Acquaintance relates people to each other.</p>
</blockquote>

<p class="commentary">Note that we take at least minimal action on this as soon as we detect it,
in the pre-pass: this is important because it may affect the classification
of subsequent sentences, which also happens in the pre-pass.
</p>

<p class="commentary">The <span class="extract"><span class="extract-syntax">:relations</span></span> set of test cases may be useful when tweaking the code below.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="function-syntax">&lt;new-relation-sentence-subject&gt;</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;article&gt;</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;np-unparsed&gt;</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;np-unparsed&gt;</span>

<span class="function-syntax">&lt;new-relation-sentence-object&gt;</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;np-unparsed&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">to</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;np-unparsed&gt;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">RelationRequests::new_relation_SMF</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">RelationRequests::new_relation_SMF</span></span>:<br/>Booting Verbs - <a href="2-bv.html#SP1_1">&#167;1.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">task</span><span class="plain-syntax">, </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">V</span><span class="plain-syntax">, </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> *</span><span class="identifier-syntax">NPs</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">SW</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">NPs</span><span class="plain-syntax">)?(</span><span class="identifier-syntax">NPs</span><span class="plain-syntax">[0]):</span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">OW</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">NPs</span><span class="plain-syntax">)?(</span><span class="identifier-syntax">NPs</span><span class="plain-syntax">[1]):</span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">task</span><span class="plain-syntax">) { </span><span class="comment-syntax"> "Knowledge relates various people to various things."</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">ACCEPT_SMFT:</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;new-relation-sentence-object&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">OW</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">parse_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">O</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;rp&gt;&gt;</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="function-syntax">&lt;new-relation-sentence-subject&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">SW</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">V</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next</span><span class="plain-syntax"> = </span><span class="function-syntax">&lt;&lt;rp&gt;&gt;</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">V</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next</span><span class="plain-syntax"> = </span><span class="identifier-syntax">O</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">RW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">V</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;relation-name&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">RW</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(),</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_RelationExists</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                        </span><span class="string-syntax">"that relation already exists"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                        </span><span class="string-syntax">"and cannot have its definition amended now."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::length</span><span class="plain-syntax">(</span><span class="identifier-syntax">RW</span><span class="plain-syntax">) &gt; </span><span class="identifier-syntax">MAX_WORDS_IN_ASSEMBLAGE</span><span class="plain-syntax">-4)</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(),</span>
<span class="plain-syntax">                        </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_RelationNameTooLong</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                        </span><span class="string-syntax">"this is too long a name for a single relation to have"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                        </span><span class="string-syntax">"and would become unwieldy."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">Node::set_new_relation_here</span><span class="plain-syntax">(</span><span class="identifier-syntax">V</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                        </span><a href="8-er.html#SP5" class="function-link"><span class="function-syntax">ExplicitRelations::make_pair_sketchily</span></a><span class="plain-syntax">(</span>
<span class="plain-syntax">                            </span><span class="identifier-syntax">WordAssemblages::from_wording</span><span class="plain-syntax">(</span><span class="identifier-syntax">RW</span><span class="plain-syntax">)));</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">PASS_1_SMFT:</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">binary_predicate</span><span class="plain-syntax"> *</span><span class="identifier-syntax">bp</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Node::get_new_relation_here</span><span class="plain-syntax">(</span><span class="identifier-syntax">V</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bp</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP2_1" class="named-paragraph-link"><span class="named-paragraph">Make the request</span><span class="named-paragraph-number">2.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>We won't create the relation here, only submit a request in the form of
the following object. The terms 0 and 1 represent the part before the "to"
and after; in "relates people to each other", they would derive from "people"
and "each other" respectively.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">relation_request</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">RW</span><span class="plain-syntax">; </span><span class="comment-syntax"> name of the relation</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">relation_request_term</span><span class="plain-syntax"> </span><span class="identifier-syntax">terms</span><span class="plain-syntax">[2];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONW</span><span class="plain-syntax">; </span><span class="comment-syntax"> condition text</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">frf</span><span class="plain-syntax">; </span><span class="comment-syntax"> has fast route-finding</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">symmetric</span><span class="plain-syntax">; </span><span class="comment-syntax"> a symmetric relation?</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">equivalence</span><span class="plain-syntax">; </span><span class="comment-syntax"> an equivalence ("in groups") relation?</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">relation_request</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">relation_request_term</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">domain</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">CALLW</span><span class="plain-syntax">; </span><span class="comment-syntax"> "calling" name</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">unique</span><span class="plain-syntax">; </span><span class="comment-syntax"> </span><span class="extract"><span class="extract-syntax">TRUE</span></span><span class="comment-syntax"> for one, </span><span class="extract"><span class="extract-syntax">FALSE</span></span><span class="comment-syntax"> for various, </span><span class="extract"><span class="extract-syntax">NOT_APPLICABLE</span></span><span class="comment-syntax"> if not yet known</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">relation_request_term</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure relation_request is accessed in 8/kpr, 8/tap, 8/tcp and here.</li><li>The structure relation_request_term is accessed in 8/aa, 8/am, 8/amd and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b>Syntax on the left (term 0) and right (term 1) slightly differs. The integer
result is a bitmap of these:
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">FRF_RBIT</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">ONE_RBIT</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">VAR_RBIT</span><span class="plain-syntax"> </span><span class="constant-syntax">4</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">ANOTHER_RBIT</span><span class="plain-syntax"> </span><span class="constant-syntax">8</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">EACHOTHER_RBIT</span><span class="plain-syntax"> </span><span class="constant-syntax">16</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">GROUPS_RBIT</span><span class="plain-syntax"> </span><span class="constant-syntax">32</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">WHEN_RBIT</span><span class="plain-syntax"> </span><span class="constant-syntax">64</span>
<span class="definition-keyword">define</span> <span class="constant-syntax">CALLED_RBIT</span><span class="plain-syntax"> </span><span class="constant-syntax">128</span>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="function-syntax">&lt;relates-sentence-left-object&gt;</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;relation-term-basic&gt;</span><span class="plain-syntax"> ( </span><span class="identifier-syntax">called</span><span class="plain-syntax"> ... ) |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;relation-term-basic&gt;</span>

<span class="function-syntax">&lt;relates-sentence-right-object&gt;</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;relation-term-right-named&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">with</span><span class="plain-syntax"> </span><span class="identifier-syntax">fast</span><span class="plain-syntax"> </span><span class="identifier-syntax">route</span><span class="plain-syntax">-</span><span class="identifier-syntax">finding</span><span class="plain-syntax"> |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;relation-term-right-named&gt;</span><span class="plain-syntax"> </span><span class="identifier-syntax">when</span><span class="plain-syntax"> ... |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;relation-term-right-named&gt;</span>

<span class="function-syntax">&lt;relation-term-right-named&gt;</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;relation-term-right&gt;</span><span class="plain-syntax"> ( </span><span class="identifier-syntax">called</span><span class="plain-syntax"> ... ) |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;relation-term-right&gt;</span>

<span class="function-syntax">&lt;relation-term-right&gt;</span>
<span class="plain-syntax">    {</span><span class="identifier-syntax">another</span><span class="plain-syntax">} |</span>
<span class="plain-syntax">    {</span><span class="identifier-syntax">each</span><span class="plain-syntax"> </span><span class="identifier-syntax">other</span><span class="plain-syntax">} |</span>
<span class="plain-syntax">    {</span><span class="identifier-syntax">each</span><span class="plain-syntax"> </span><span class="identifier-syntax">other</span><span class="plain-syntax"> </span><span class="identifier-syntax">in</span><span class="plain-syntax"> </span><span class="identifier-syntax">groups</span><span class="plain-syntax">} |</span>
<span class="plain-syntax">    </span><span class="function-syntax">&lt;relation-term-basic&gt;</span>

<span class="function-syntax">&lt;relation-term-basic&gt;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">one</span><span class="plain-syntax"> ... |</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">various</span><span class="plain-syntax"> ... |</span>
<span class="plain-syntax">    ...</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2_1" class="paragraph-anchor"></a><b>&#167;2.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Make the request</span><span class="named-paragraph-number">2.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">relation_request</span><span class="plain-syntax"> </span><span class="identifier-syntax">RR</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">RW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Node::get_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">V</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">next</span><span class="plain-syntax">); </span><span class="comment-syntax"> relation name</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">CONW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">frf</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">symmetric</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">equivalence</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">TW</span><span class="plain-syntax">[2];</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">bitmap</span><span class="plain-syntax">[2]; </span><span class="comment-syntax"> bitmap of the </span><span class="extract"><span class="extract-syntax">*_RBIT</span></span><span class="comment-syntax"> values</span>

<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP2_1_1" class="named-paragraph-link"><span class="named-paragraph">Parse left and right object phrases</span><span class="named-paragraph-number">2.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP2_1_2" class="named-paragraph-link"><span class="named-paragraph">Find term multiplicities and use of fast route-finding</span><span class="named-paragraph-number">2.1.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP2_1_3" class="named-paragraph-link"><span class="named-paragraph">Detect use of symmetry in definition of second term</span><span class="named-paragraph-number">2.1.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP2_1_4" class="named-paragraph-link"><span class="named-paragraph">Detect use of a condition for a test-only relation</span><span class="named-paragraph-number">2.1.4</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP2_1_5" class="named-paragraph-link"><span class="named-paragraph">Vet the use of callings for the terms of the relation</span><span class="named-paragraph-number">2.1.5</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP2_1_6" class="named-paragraph-link"><span class="named-paragraph">Find the left and right domain kinds</span><span class="named-paragraph-number">2.1.6</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP2_1_7" class="named-paragraph-link"><span class="named-paragraph">Infer uniqueness if not specified</span><span class="named-paragraph-number">2.1.7</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">RELATION_DEFINITIONS</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"Relation defn: '%W' %s %s %s (%s %u, %s %u)\n"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">RW</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">symmetric</span><span class="plain-syntax">)?</span><span class="string-syntax">"symmetric"</span><span class="plain-syntax">:</span><span class="string-syntax">"asymmetric"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">equivalence</span><span class="plain-syntax">)?</span><span class="string-syntax">"equivalence"</span><span class="plain-syntax">:</span><span class="string-syntax">"non-equivalence"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">frf</span><span class="plain-syntax">)?</span><span class="string-syntax">"frf"</span><span class="plain-syntax">:</span><span class="string-syntax">"no-frf"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">unique</span><span class="plain-syntax">)?</span><span class="string-syntax">"one"</span><span class="plain-syntax">:</span><span class="string-syntax">"various"</span><span class="plain-syntax">, </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">domain</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">unique</span><span class="plain-syntax">)?</span><span class="string-syntax">"one"</span><span class="plain-syntax">:</span><span class="string-syntax">"various"</span><span class="plain-syntax">, </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">domain</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-nrr.html#SP7" class="function-link"><span class="function-syntax">RelationRequests::new</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">RR</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP2">&#167;2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_1_1" class="paragraph-anchor"></a><b>&#167;2.1.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Parse left and right object phrases</span><span class="named-paragraph-number">2.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="function-syntax">&lt;relates-sentence-left-object&gt;(Node::get_text(V-&gt;next-&gt;</span><span class="element-syntax">next</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">bitmap</span><span class="plain-syntax">[0] = </span><span class="function-syntax">&lt;&lt;r&gt;&gt;</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">CALLW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">; </span><span class="comment-syntax"> left term "calling" name</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bitmap</span><span class="plain-syntax">[0] &amp; </span><span class="constant-syntax">CALLED_RBIT</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">CALLW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;relates-sentence-left-object&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TW</span><span class="plain-syntax">[0] = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;relation-term-basic&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">unique</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NOT_APPLICABLE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">domain</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="function-syntax">&lt;relates-sentence-right-object&gt;(Node::get_text(V-&gt;next-&gt;next-&gt;</span><span class="element-syntax">next</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">bitmap</span><span class="plain-syntax">[1] = </span><span class="function-syntax">&lt;&lt;r&gt;&gt;</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">CALLW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">EMPTY_WORDING</span><span class="plain-syntax">; </span><span class="comment-syntax"> right term "calling" name</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bitmap</span><span class="plain-syntax">[1] &amp; </span><span class="constant-syntax">CALLED_RBIT</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">CALLW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;relation-term-right-named&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TW</span><span class="plain-syntax">[1] = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;relation-term-basic&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">unique</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NOT_APPLICABLE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">domain</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bitmap</span><span class="plain-syntax">[1] &amp; </span><span class="constant-syntax">WHEN_RBIT</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">CONW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">GET_RW</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;relates-sentence-right-object&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP2_1">&#167;2.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_1_2" class="paragraph-anchor"></a><b>&#167;2.1.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Find term multiplicities and use of fast route-finding</span><span class="named-paragraph-number">2.1.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bitmap</span><span class="plain-syntax">[0] &amp; </span><span class="constant-syntax">ONE_RBIT</span><span class="plain-syntax">) </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">unique</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bitmap</span><span class="plain-syntax">[0] &amp; </span><span class="constant-syntax">VAR_RBIT</span><span class="plain-syntax">) </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">unique</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bitmap</span><span class="plain-syntax">[1] &amp; </span><span class="constant-syntax">ONE_RBIT</span><span class="plain-syntax">) </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">unique</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bitmap</span><span class="plain-syntax">[1] &amp; </span><span class="constant-syntax">VAR_RBIT</span><span class="plain-syntax">) </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">unique</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bitmap</span><span class="plain-syntax">[1] &amp; </span><span class="constant-syntax">FRF_RBIT</span><span class="plain-syntax">) </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">frf</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">frf</span><span class="plain-syntax"> &amp;&amp; (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">unique</span><span class="plain-syntax"> != </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">unique</span><span class="plain-syntax"> != </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_FRFUnavailable</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"fast route-finding is only possible with various-to-various "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"relations"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"though this doesn't matter because with other relations the "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"standard route-finding algorithm is efficient already."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP2_1">&#167;2.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_1_3" class="paragraph-anchor"></a><b>&#167;2.1.3. </b>The second term can be given in several special ways to indicate symmetry
between the two terms. This is more than a declaration that the left and
right terms belong to the same domain set (though that is true): it says
that \(R(x, y)\) is true if and only if \(R(y, x)\) is true.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Detect use of symmetry in definition of second term</span><span class="named-paragraph-number">2.1.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">specified_one</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">unique</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bitmap</span><span class="plain-syntax">[1] &amp; </span><span class="constant-syntax">ANOTHER_RBIT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">symmetric</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">; </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">unique</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">; </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">unique</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bitmap</span><span class="plain-syntax">[1] &amp; </span><span class="constant-syntax">EACHOTHER_RBIT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">symmetric</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">; </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">unique</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">; </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">unique</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bitmap</span><span class="plain-syntax">[1] &amp; </span><span class="constant-syntax">GROUPS_RBIT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">symmetric</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">; </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">unique</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">; </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">unique</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">equivalence</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">specified_one</span><span class="plain-syntax"> == </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">unique</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_BothOneAndMany</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"the left-hand term in this relation seems to be both 'one' thing "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"and also many things"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"given the mention of 'each other'. Try removing the 'one'."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP2_1">&#167;2.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_1_4" class="paragraph-anchor"></a><b>&#167;2.1.4. </b>When a relation is said to hold depending on a condition to be tested at
run-time, it is meaningless to tell Inform anything about the uniqueness of
terms in the domain: a relation might be one-to-one at the start of play
but become various-to-various later on, as the outcomes of these tests
change. So we reject any such misleading syntax.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Detect use of a condition for a test-only relation</span><span class="named-paragraph-number">2.1.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bitmap</span><span class="plain-syntax">[1] &amp; </span><span class="constant-syntax">WHEN_RBIT</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">unique</span><span class="plain-syntax"> != </span><span class="identifier-syntax">NOT_APPLICABLE</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">unique</span><span class="plain-syntax"> != </span><span class="identifier-syntax">NOT_APPLICABLE</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_OneOrVariousWithWhen</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                </span><span class="string-syntax">"this relation is a mixture of different syntaxes"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"and must be simplified. If it is going to specify 'one' or "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"'various' then it cannot also say 'when' the relation holds."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP2_1">&#167;2.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_1_5" class="paragraph-anchor"></a><b>&#167;2.1.5. </b>To give a name to one term implies some degree of uniqueness about it.
But that only makes sense if there is indeed some uniqueness involved,
because otherwise it is unclear what the name refers to. Who is "the
greeter of the Queen of Sheba" given the following definition?
</p>

<blockquote>
    <p>Acquaintance relates various people (called the greeter) to various people.</p>
</blockquote>

<p class="commentary">Because of that, callings are only allowed in certain circumstances. An
exception is made &mdash; that is, they are always allowed &mdash; where the relation
tests a given condition, because then the names identify the terms, e.g.,
</p>

<blockquote>
    <p>Divisibility relates a number (called N) to a number (called M) when the remainder after dividing M by N is 0.</p>
</blockquote>

<p class="commentary">Here the names "N" and "M" unambiguously refer to the terms being tested
at this moment, and have no currency beyond that context.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Vet the use of callings for the terms of the relation</span><span class="named-paragraph-number">2.1.5</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::empty</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">CONW</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">unique</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">CALLW</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_CantCallLeft</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                </span><span class="string-syntax">"the left-hand term of this relation is not unique"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"so you cannot assign a name to it using 'called'."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">unique</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">CALLW</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_CantCallRight</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                </span><span class="string-syntax">"the right-hand term of this relation is not unique"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"so you cannot assign a name to it using 'called'."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">CALLW</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">CALLW</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_CantCallBoth</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                </span><span class="string-syntax">"the terms of the relation can't be named on both sides at once"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"and because of that it's best to use a single even-handed name: "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"for instance, 'Marriage relates one person to another (called "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"the spouse).' rather than 'Employment relates one person (called "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"the boss) to one person (called the underling).'"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">symmetric</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">unique</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">unique</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">CALLW</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_OneToOneMiscalled</span><span class="plain-syntax">),</span>
<span class="plain-syntax">                </span><span class="string-syntax">"with a one-to-one relation which is not symmetrical "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"only the left-hand item can be given a name using 'called'"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="string-syntax">"so this needs rephrasing to name the left in terms of the right "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"rather than vice versa. For instance, 'Transmission relates "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"one remote to one gadget (called the target).' should be "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"rephrased as 'Transmission relates one gadget (called the "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"target) to one remote.' It will then be possible to talk about "</span>
<span class="plain-syntax">                </span><span class="string-syntax">"'the gadget of' any given remote."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP2_1">&#167;2.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_1_6" class="paragraph-anchor"></a><b>&#167;2.1.6. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Find the left and right domain kinds</span><span class="named-paragraph-number">2.1.6</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">domain</span><span class="plain-syntax"> = </span><a href="3-nrr.html#SP5" class="function-link"><span class="function-syntax">RelationRequests::parse_term</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">TW</span><span class="plain-syntax">[0], </span><span class="string-syntax">"left"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">symmetric</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">domain</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">domain</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">domain</span><span class="plain-syntax"> = </span><a href="3-nrr.html#SP5" class="function-link"><span class="function-syntax">RelationRequests::parse_term</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">TW</span><span class="plain-syntax">[1], </span><span class="string-syntax">"right"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">domain</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">domain</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP2_1">&#167;2.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_1_7" class="paragraph-anchor"></a><b>&#167;2.1.7. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Infer uniqueness if not specified</span><span class="named-paragraph-number">2.1.7</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">unique</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NOT_APPLICABLE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">unique</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">CALLW</span><span class="plain-syntax">)) || (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">unique</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">unique</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">unique</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NOT_APPLICABLE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">unique</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">CALLW</span><span class="plain-syntax">)) || (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">unique</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">RR</span><span class="plain-syntax">.</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">unique</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP2_1">&#167;2.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>A term is specified as a kind:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="function-syntax">RelationRequests::parse_term</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">RelationRequests::parse_term</span></span>:<br/><a href="3-nrr.html#SP2_1_6">&#167;2.1.6</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="reserved-syntax">char</span><span class="plain-syntax"> *</span><span class="identifier-syntax">side</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="function-syntax">&lt;k-kind-articled&gt;</span><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="function-syntax">&lt;&lt;rp&gt;&gt;</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Problems::quote_source</span><span class="plain-syntax">(1, </span><span class="identifier-syntax">current_sentence</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Problems::quote_wording</span><span class="plain-syntax">(2, </span><span class="identifier-syntax">W</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Problems::quote_text</span><span class="plain-syntax">(3, </span><span class="identifier-syntax">side</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">StandardProblems::handmade_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_RelatedKindsUnknown</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Problems::issue_problem_segment</span><span class="plain-syntax">(</span>
<span class="plain-syntax">        </span><span class="string-syntax">"In the relation definition %1, I am unable to understand the %3-hand "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"side -- I was expecting that %2 would be either the name of a kind, "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"or the name of a kind of value, but it wasn't either of those."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Problems::issue_problem_end</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">by_function_bp_data</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">condition_defn_text</span><span class="plain-syntax">; </span><span class="comment-syntax"> ...unless this I7 condition is used instead</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">bp_by_routine_iname</span><span class="plain-syntax">; </span><span class="comment-syntax"> routine to determine</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">by_function_bp_data</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">equivalence_bp_data</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> *</span><span class="identifier-syntax">equivalence_partition</span><span class="plain-syntax">; </span><span class="comment-syntax"> (if right way) partition array of equivalence classes</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">equivalence_bp_data</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure by_function_bp_data is private to this section.</li><li>The structure equivalence_bp_data is private to this section.</li></ul>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. Creation, Stage II.</b>Altogether, the Inform user is allowed to define some eight different forms
of relation. The code below is an attempt to find whatever common ground
can be found from these different outcomes, but inevitably ends up
splitting into cases.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RelationRequests::new</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">RelationRequests::new</span></span>:<br/><a href="3-nrr.html#SP2_1">&#167;2.1</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">binary_predicate</span><span class="plain-syntax"> *</span><span class="identifier-syntax">bp</span><span class="plain-syntax">, </span><span class="reserved-syntax">relation_request</span><span class="plain-syntax"> *</span><span class="identifier-syntax">RR</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">binary_predicate</span><span class="plain-syntax"> *</span><span class="identifier-syntax">bpr</span><span class="plain-syntax"> = </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">reversal</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">property</span><span class="plain-syntax"> *</span><span class="identifier-syntax">prn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">; </span><span class="comment-syntax"> used for run-time storage of this relation</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_name</span><span class="plain-syntax"> *</span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">; </span><span class="comment-syntax"> the I6 identifier for this property</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">; </span><span class="comment-syntax"> what kind, if any, might be stored in it</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">storage_infs</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">; </span><span class="comment-syntax"> summing these up</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">explicit_bp_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ED</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RETRIEVE_POINTER_explicit_bp_data</span><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">family_specific</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">dynamic</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">, </span><span class="comment-syntax"> use dynamic memory allocation for storage?</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">provide_prn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">, </span><span class="comment-syntax"> allocate the storage property to the kind?</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">calling_made</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">; </span><span class="comment-syntax"> one of the terms has been given a name</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bp</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"BP in relation not initially parsed"</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP7_1" class="named-paragraph-link"><span class="named-paragraph">Parse the classification variables and use them to fill in the BP term details</span><span class="named-paragraph-number">7.1</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">frf</span><span class="plain-syntax">) </span><span class="identifier-syntax">RTRelations::use_frf</span><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">prn</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">ED</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">i6_storage_property</span><span class="plain-syntax"> = </span><span class="identifier-syntax">prn</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">ValueProperties::set_stored_relation</span><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">, </span><span class="identifier-syntax">bp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dynamic</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><a href="8-er.html#SP4" class="function-link"><span class="function-syntax">ExplicitRelations::store_dynamically</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="8-er.html#SP4" class="function-link"><span class="function-syntax">ExplicitRelations::store_dynamically</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">bpr</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RTRelations::initialiser_iname</span><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">RTRelations::mark_as_needed</span><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">CONW</span><span class="plain-syntax">)) </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP7_10" class="named-paragraph-link"><span class="named-paragraph">Complete as a relation-by-routine BP</span><span class="named-paragraph-number">7.10</span></a></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">equivalence</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP7_9" class="named-paragraph-link"><span class="named-paragraph">Complete as an equivalence-relation BP</span><span class="named-paragraph-number">7.9</span></a></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">unique</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">unique</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symmetric</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP7_7" class="named-paragraph-link"><span class="named-paragraph">Complete as a symmetric one-to-one BP</span><span class="named-paragraph-number">7.7</span></a></span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP7_3" class="named-paragraph-link"><span class="named-paragraph">Complete as an asymmetric one-to-one BP</span><span class="named-paragraph-number">7.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP7_4" class="named-paragraph-link"><span class="named-paragraph">Complete as a one-to-various BP</span><span class="named-paragraph-number">7.4</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">unique</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP7_5" class="named-paragraph-link"><span class="named-paragraph">Complete as a various-to-one BP</span><span class="named-paragraph-number">7.5</span></a></span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symmetric</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP7_8" class="named-paragraph-link"><span class="named-paragraph">Complete as a symmetric various-to-various BP</span><span class="named-paragraph-number">7.8</span></a></span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP7_6" class="named-paragraph-link"><span class="named-paragraph">Complete as an asymmetric various-to-various BP</span><span class="named-paragraph-number">7.6</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">dynamic</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">calling_made</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP7_2" class="named-paragraph-link"><span class="named-paragraph">Issue a problem message since this won't be stored in a property</span><span class="named-paragraph-number">7.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP7_12" class="named-paragraph-link"><span class="named-paragraph">Override with dynamic allocation schemata</span><span class="named-paragraph-number">7.12</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TheHeap::ensure_basic_heap_present</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">provide_prn</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Assert::true_about</span><span class="plain-syntax">(</span>
<span class="plain-syntax">                </span><a href="8-cu.html#SP5" class="function-link"><span class="function-syntax">Propositions::Abstract::to_provide_property</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">), </span><span class="identifier-syntax">storage_infs</span><span class="plain-syntax">, </span><span class="identifier-syntax">prevailing_mood</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP7_11" class="named-paragraph-link"><span class="named-paragraph">Add in the reducing functions</span><span class="named-paragraph-number">7.11</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Kinds::Behaviour::is_subkind_of_object</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">domain</span><span class="plain-syntax">)) ||</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">Kinds::Behaviour::is_subkind_of_object</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">domain</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">relation_guard</span><span class="plain-syntax"> *</span><span class="identifier-syntax">rg</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="identifier-syntax">relation_guard</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">check_L</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">; </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Kinds::Behaviour::is_subkind_of_object</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">domain</span><span class="plain-syntax">)) </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">check_L</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">domain</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">check_R</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">; </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Kinds::Behaviour::is_subkind_of_object</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">domain</span><span class="plain-syntax">)) </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">check_R</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">domain</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">inner_test</span><span class="plain-syntax"> = </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">TEST_ATOM_TASK</span><span class="plain-syntax">];</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">inner_make_true</span><span class="plain-syntax"> = </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK</span><span class="plain-syntax">];</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">inner_make_false</span><span class="plain-syntax"> = </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK</span><span class="plain-syntax">];</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">guarding</span><span class="plain-syntax"> = </span><span class="identifier-syntax">bp</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">f0</span><span class="plain-syntax"> = </span><span class="identifier-syntax">BPTerms::get_function</span><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">term_details</span><span class="plain-syntax">[0]));</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">f1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">BPTerms::get_function</span><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">term_details</span><span class="plain-syntax">[1]));</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">guard_f0_iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">guard_f1_iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">guard_test_iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">guard_make_true_iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">guard_make_false_iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">f0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">package_request</span><span class="plain-syntax"> *</span><span class="identifier-syntax">R</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RTRelations::package</span><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">guard_f0_iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Hierarchy::make_iname_in</span><span class="plain-syntax">(</span><span class="identifier-syntax">GUARD_F0_FN_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">R</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">BPTerms::set_function</span><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">term_details</span><span class="plain-syntax">[0]),</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"(%n(*1))"</span><span class="plain-syntax">, </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">guard_f0_iname</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">f1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">package_request</span><span class="plain-syntax"> *</span><span class="identifier-syntax">R</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RTRelations::package</span><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">guard_f1_iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Hierarchy::make_iname_in</span><span class="plain-syntax">(</span><span class="identifier-syntax">GUARD_F1_FN_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">R</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">BPTerms::set_function</span><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">term_details</span><span class="plain-syntax">[1]),</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"(%n(*1))"</span><span class="plain-syntax">, </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">guard_f1_iname</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">TEST_ATOM_TASK</span><span class="plain-syntax">]) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">package_request</span><span class="plain-syntax"> *</span><span class="identifier-syntax">R</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RTRelations::package</span><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">guard_test_iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Hierarchy::make_iname_in</span><span class="plain-syntax">(</span><span class="identifier-syntax">GUARD_TEST_FN_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">R</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">TEST_ATOM_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"(%n(*1,*2))"</span><span class="plain-syntax">, </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">guard_test_iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK</span><span class="plain-syntax">]) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">package_request</span><span class="plain-syntax"> *</span><span class="identifier-syntax">R</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RTRelations::package</span><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">guard_make_true_iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Hierarchy::make_iname_in</span><span class="plain-syntax">(</span><span class="identifier-syntax">GUARD_MAKE_TRUE_FN_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">R</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"(%n(*1,*2))"</span><span class="plain-syntax">, </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">guard_make_true_iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK</span><span class="plain-syntax">]) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">package_request</span><span class="plain-syntax"> *</span><span class="identifier-syntax">R</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RTRelations::package</span><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">guard_make_false_iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Hierarchy::make_iname_in</span><span class="plain-syntax">(</span><span class="identifier-syntax">GUARD_MAKE_FALSE_INAME_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">R</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"(%n(*1,*2))"</span><span class="plain-syntax">, </span><span class="identifier-syntax">rg</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">guard_make_false_iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RTRelations::guard</span><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">, </span><span class="identifier-syntax">rg</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">RELATION_DEFINITIONS</span><span class="plain-syntax">, </span><span class="string-syntax">"Defined the binary predicate:\n$2\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">bp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7_1" class="paragraph-anchor"></a><b>&#167;7.1. The parsing phase.</b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Parse the classification variables and use them to fill in the BP term details</span><span class="named-paragraph-number">7.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP7_1_2" class="named-paragraph-link"><span class="named-paragraph">Detect callings for the terms of the relation</span><span class="named-paragraph-number">7.1.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP7_1_3" class="named-paragraph-link"><span class="named-paragraph">Work out the kinds of the terms in the relation</span><span class="named-paragraph-number">7.1.3</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::empty</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">CONW</span><span class="plain-syntax">)) </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP7_1_4" class="named-paragraph-link"><span class="named-paragraph">Determine property used for run-time storage</span><span class="named-paragraph-number">7.1.4</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-nrr.html#SP7_1_1" class="named-paragraph-link"><span class="named-paragraph">Fill in the BP term details based on the left- and right- variables</span><span class="named-paragraph-number">7.1.1</span></a></span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7_1_1" class="paragraph-anchor"></a><b>&#167;7.1.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Fill in the BP term details based on the left- and right- variables</span><span class="named-paragraph-number">7.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">bp_term_details</span><span class="plain-syntax"> </span><span class="identifier-syntax">left_bptd</span><span class="plain-syntax">, </span><span class="identifier-syntax">right_bptd</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">inference_subject</span><span class="plain-syntax"> *</span><span class="identifier-syntax">left_infs</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, *</span><span class="identifier-syntax">right_infs</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">domain</span><span class="plain-syntax">) </span><span class="identifier-syntax">left_infs</span><span class="plain-syntax"> = </span><span class="identifier-syntax">KindSubjects::from_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">domain</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">domain</span><span class="plain-syntax">) </span><span class="identifier-syntax">right_infs</span><span class="plain-syntax"> = </span><span class="identifier-syntax">KindSubjects::from_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">domain</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">left_bptd</span><span class="plain-syntax"> = </span><span class="identifier-syntax">BPTerms::new_full</span><span class="plain-syntax">(</span><span class="identifier-syntax">left_infs</span><span class="plain-syntax">, </span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">domain</span><span class="plain-syntax">, </span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">CALLW</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">right_bptd</span><span class="plain-syntax"> = </span><span class="identifier-syntax">BPTerms::new_full</span><span class="plain-syntax">(</span><span class="identifier-syntax">right_infs</span><span class="plain-syntax">, </span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">domain</span><span class="plain-syntax">, </span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">CALLW</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">term_details</span><span class="plain-syntax">[0] = </span><span class="identifier-syntax">left_bptd</span><span class="plain-syntax">; </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">term_details</span><span class="plain-syntax">[1] = </span><span class="identifier-syntax">right_bptd</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">bpr</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">term_details</span><span class="plain-syntax">[0] = </span><span class="identifier-syntax">right_bptd</span><span class="plain-syntax">; </span><span class="identifier-syntax">bpr</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">term_details</span><span class="plain-syntax">[1] = </span><span class="identifier-syntax">left_bptd</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP7_1">&#167;7.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7_1_2" class="paragraph-anchor"></a><b>&#167;7.1.2. </b>Callings are used to give names to the terms on each side of the relation,
e.g.,
</p>

<blockquote>
    <p>Lock-fitting relates one thing (called the matching key) to various things.</p>
</blockquote>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Detect callings for the terms of the relation</span><span class="named-paragraph-number">7.1.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">CALLW</span><span class="plain-syntax">)) || (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">CALLW</span><span class="plain-syntax">)))</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">calling_made</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP7_1">&#167;7.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7_1_3" class="paragraph-anchor"></a><b>&#167;7.1.3. </b>Here we find out the kind which forms the domain on either side. Ideally
we want each to be a fixed-size and fairly small domain set; actually, best
of all is for both kinds to be within "object", since that can be stored
very efficiently, and the worst case is to be forced into "dynamic" storage:
this means using up heap memory allocated dynamically at run-time.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Work out the kinds of the terms in the relation</span><span class="named-paragraph-number">7.1.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::empty</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">CONW</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Kinds::Behaviour::is_subkind_of_object</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">domain</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">            (</span><a href="3-nrr.html#SP10" class="function-link"><span class="function-syntax">RelationRequests::check_finite_range</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">domain</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)) </span><span class="identifier-syntax">dynamic</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Kinds::Behaviour::is_subkind_of_object</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">domain</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symmetric</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">            (</span><a href="3-nrr.html#SP10" class="function-link"><span class="function-syntax">RelationRequests::check_finite_range</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">domain</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)) </span><span class="identifier-syntax">dynamic</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP7_1">&#167;7.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7_1_4" class="paragraph-anchor"></a><b>&#167;7.1.4. </b>All forms of relation we can produce from here use an I6 property for
run-time storage (though different forms of relation use it differently).
We use the calling, if any, to name this property: if there are no
callings, then it gets a name like "concealment relation storage", and is
omitted from the index.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Determine property used for run-time storage</span><span class="named-paragraph-number">7.1.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">CALLW</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">prn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ValueProperties::obtain_within_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">CALLW</span><span class="plain-syntax">, </span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">domain</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">prn</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Wordings::nonempty</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">CALLW</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">prn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ValueProperties::obtain_within_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">CALLW</span><span class="plain-syntax">, </span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">domain</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">prn</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">word_assemblage</span><span class="plain-syntax"> </span><span class="identifier-syntax">pw_wa</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">PreformUtilities::merge</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;relation-storage-construction&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">WordAssemblages::from_wording</span><span class="plain-syntax">(</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">RW</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">PW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordAssemblages::to_wording</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">pw_wa</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">prn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">ValueProperties::obtain_within_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">PW</span><span class="plain-syntax">, </span><span class="identifier-syntax">K_object</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">prn</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RTProperties::dont_show_in_index</span><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RTProperties::iname</span><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">domain</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">PK</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">unique</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">domain</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">domain</span><span class="plain-syntax">) </span><span class="identifier-syntax">PK</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">domain</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">unique</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">domain</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">domain</span><span class="plain-syntax">) </span><span class="identifier-syntax">PK</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">domain</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">PK</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Kinds::Behaviour::is_object</span><span class="plain-syntax">(</span><span class="identifier-syntax">PK</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)) </span><span class="identifier-syntax">ValueProperties::set_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">, </span><span class="identifier-syntax">PK</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax">) </span><span class="identifier-syntax">storage_infs</span><span class="plain-syntax"> = </span><span class="identifier-syntax">KindSubjects::from_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">storage_infs</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (((</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">unique</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">unique</span><span class="plain-syntax">)) &amp;&amp; (</span><span class="identifier-syntax">PK</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">Kinds::Behaviour::is_object</span><span class="plain-syntax">(</span><span class="identifier-syntax">PK</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RTProperties::use_non_typesafe_0</span><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP7_1">&#167;7.1</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7_2" class="paragraph-anchor"></a><b>&#167;7.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Issue a problem message since this won't be stored in a property</span><span class="named-paragraph-number">7.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_RelNotStoredInProperty</span><span class="plain-syntax">),</span>
<span class="plain-syntax">        </span><span class="string-syntax">"a '(called ...)' name can't be used for this relation"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="string-syntax">"because of the kinds involved in it. (Names for terms in a relation "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"only work if it's possible to store the relation using properties, "</span>
<span class="plain-syntax">        </span><span class="string-syntax">"but that's impossible here, so Inform uses a different scheme.)"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. The completion phase.</b>At this point the BP is filled in except for: its form; the schemas for
testing, asserting true and asserting false; the run-time storage property
to be used, if any; and any fields which are specific to the form in
question. Anyway, there are eight possible forms of explicit BP, so
here are eight paragraphs creating them.
</p>

<p class="commentary firstcommentary"><a id="SP7_3" class="paragraph-anchor"></a><b>&#167;7.3. </b>The <span class="extract"><span class="extract-syntax">Relation_OtoO</span></span> case, or one to one: "R relates one K to one K".
</p>

<p class="commentary">Such a relation consumes run-time storage of \(5D\) bytes on the Z-machine
and \(14D\) bytes on Glulx, where \(D\) is the size of the domain...
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Complete as an asymmetric one-to-one BP</span><span class="named-paragraph-number">7.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">ED</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">form_of_relation</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Relation_OtoO</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">provide_prn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Kinds::Behaviour::is_object</span><span class="plain-syntax">(</span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"Relation_Now1to1(*2,%n,*1)"</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"Relation_NowN1toV(*2,%n,*1)"</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"Relation_Now1to1V(*2,*1,%k,%n)"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"Relation_NowN1toVV(*2,*1,%k,%n)"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7_4" class="paragraph-anchor"></a><b>&#167;7.4. </b>The <span class="extract"><span class="extract-syntax">Relation_OtoV</span></span> case, or one to various: "R relates one K to various K".
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Complete as a one-to-various BP</span><span class="named-paragraph-number">7.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">ED</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">form_of_relation</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Relation_OtoV</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">provide_prn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Kinds::Behaviour::is_object</span><span class="plain-syntax">(</span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"*2.%n = *1"</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"Relation_NowN1toV(*2,%n,*1)"</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"WriteGProperty(%k, *2, %n, *1)"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"Relation_NowN1toVV(*2,*1,%k,%n)"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7_5" class="paragraph-anchor"></a><b>&#167;7.5. </b>The <span class="extract"><span class="extract-syntax">Relation_VtoO</span></span> case, or various to one: "R relates various K to one K".
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Complete as a various-to-one BP</span><span class="named-paragraph-number">7.5</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">ED</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">form_of_relation</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Relation_VtoO</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">provide_prn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Kinds::Behaviour::is_object</span><span class="plain-syntax">(</span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"*1.%n = *2"</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"Relation_NowN1toV(*1,%n,*2)"</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"WriteGProperty(%k, *1, %n, *2)"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"Relation_NowN1toVV(*1,*2,%k,%n)"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7_6" class="paragraph-anchor"></a><b>&#167;7.6. </b>The <span class="extract"><span class="extract-syntax">Relation_VtoV</span></span> case, or various to various: "R relates various K to
various K".
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Complete as an asymmetric various-to-various BP</span><span class="named-paragraph-number">7.6</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">ED</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">form_of_relation</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Relation_VtoV</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">TEST_ATOM_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"(Relation_TestVtoV(*1,%n,*2,false))"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RTRelations::iname</span><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"(Relation_NowVtoV(*1,%n,*2,false))"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RTRelations::iname</span><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"(Relation_NowNVtoV(*1,%n,*2,false))"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RTRelations::iname</span><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">));</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7_7" class="paragraph-anchor"></a><b>&#167;7.7. </b>The <span class="extract"><span class="extract-syntax">Relation_Sym_OtoO</span></span> case, or symmetric one to one: "R relates one K to
another".
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Complete as a symmetric one-to-one BP</span><span class="named-paragraph-number">7.7</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">ED</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">form_of_relation</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Relation_Sym_OtoO</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">provide_prn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Kinds::Behaviour::is_object</span><span class="plain-syntax">(</span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"Relation_NowS1to1(*2,%n,*1)"</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"Relation_NowSN1to1(*2,%n,*1)"</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"Relation_NowS1to1V(*2,*1,%k,%n)"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"Relation_NowSN1to1V(*2,*1,%k,%n)"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7_8" class="paragraph-anchor"></a><b>&#167;7.8. </b>The <span class="extract"><span class="extract-syntax">Relation_Sym_VtoV</span></span> case, or symmetric various to various: "R relates K
to each other".
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Complete as a symmetric various-to-various BP</span><span class="named-paragraph-number">7.8</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">ED</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">form_of_relation</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Relation_Sym_VtoV</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">TEST_ATOM_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"(Relation_TestVtoV(*1,%n,*2,true))"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RTRelations::iname</span><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"(Relation_NowVtoV(*1,%n,*2,true))"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RTRelations::iname</span><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"(Relation_NowNVtoV(*1,%n,*2,true))"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">RTRelations::iname</span><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">));</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7_9" class="paragraph-anchor"></a><b>&#167;7.9. </b>The <span class="extract"><span class="extract-syntax">Relation_Equiv</span></span> case, or equivalence relation: "R relates K to each
other in groups".
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Complete as an equivalence-relation BP</span><span class="named-paragraph-number">7.9</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">ED</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">form_of_relation</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Relation_Equiv</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">equivalence_bp_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">equivalence_bp_data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">D</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">equivalence_partition</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ED</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">equiv_data</span><span class="plain-syntax"> = </span><span class="identifier-syntax">D</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">provide_prn</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Kinds::Behaviour::is_object</span><span class="plain-syntax">(</span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">TEST_ATOM_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"(*1.%n == *2.%n)"</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"Relation_NowEquiv(*1,%n,*2)"</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"Relation_NowNEquiv(*1,%n,*2)"</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">TEST_ATOM_TASK</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"(%k &gt;&gt; *1 . %n == %k &gt;&gt; *2 . %n)"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">, </span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"Relation_NowEquivV(*1,*2,%k,%n)"</span><span class="plain-syntax">, </span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"Relation_NowNEquivV(*1,*2,%k,%n)"</span><span class="plain-syntax">, </span><span class="identifier-syntax">storage_kind</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ValueProperties::set_kind</span><span class="plain-syntax">(</span><span class="identifier-syntax">prn</span><span class="plain-syntax">, </span><span class="identifier-syntax">K_number</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7_10" class="paragraph-anchor"></a><b>&#167;7.10. </b>The case of a relation tested by a routine: "R relates K to L when (some
condition)".
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Complete as a relation-by-routine BP</span><span class="named-paragraph-number">7.10</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">relation_family</span><span class="plain-syntax"> = </span><span class="identifier-syntax">by_function_bp_family</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">reversal</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">relation_family</span><span class="plain-syntax"> = </span><span class="identifier-syntax">by_function_bp_family</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">package_request</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RTRelations::package</span><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">by_function_bp_data</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">by_function_bp_data</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">D</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">condition_defn_text</span><span class="plain-syntax"> = </span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">CONW</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">D</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">bp_by_routine_iname</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Hierarchy::make_iname_in</span><span class="plain-syntax">(</span><span class="identifier-syntax">RELATION_FN_HL</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">TEST_ATOM_TASK</span><span class="plain-syntax">] = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"(%n(*1,*2))"</span><span class="plain-syntax">, </span><span class="identifier-syntax">D</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">bp_by_routine_iname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">family_specific</span><span class="plain-syntax"> = </span><span class="identifier-syntax">STORE_POINTER_by_function_bp_data</span><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7_11" class="paragraph-anchor"></a><b>&#167;7.11. </b>The left- and right- local variables above provide us with convenient
aliases for the entries which will end up in the <span class="extract"><span class="extract-syntax">bp_term_details</span></span>
structures attached to the BP: this is where we put them back.
</p>

<p class="commentary">For the meaning of functions \(f_0\) and \(f_1\), see "Binary Predicates.w".
The idea here is this: suppose we have a relation of objects where the only
true outcomes have the form \(B(f_0(y), y)\). At run-time we store the
identity of the counterpart object \(f_0(y)\) in the <span class="extract"><span class="extract-syntax">prn</span></span> property of the
original object \(y\).
</p>

<p class="commentary">And we similarly construct an \(f_1\) function if the only true outcomes
have the form \(B(x, f_1(x))\).
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Add in the reducing functions</span><span class="named-paragraph-number">7.11</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">i6_schema</span><span class="plain-syntax"> *</span><span class="identifier-syntax">f0</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, *</span><span class="identifier-syntax">f1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">unique</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">domain</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">f0</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"(%k &gt;&gt; *1 . %n)"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">domain</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[1].</span><span class="element-syntax">unique</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">domain</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">f1</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"(%k &gt;&gt; *1 . %n)"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">RR</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">terms</span><span class="plain-syntax">[0].</span><span class="element-syntax">domain</span><span class="plain-syntax">, </span><span class="identifier-syntax">i6_prn_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">f0</span><span class="plain-syntax">) </span><span class="identifier-syntax">BPTerms::set_function</span><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">term_details</span><span class="plain-syntax">[0]), </span><span class="identifier-syntax">f0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">f1</span><span class="plain-syntax">) </span><span class="identifier-syntax">BPTerms::set_function</span><span class="plain-syntax">(&amp;(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">term_details</span><span class="plain-syntax">[1]), </span><span class="identifier-syntax">f1</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7_12" class="paragraph-anchor"></a><b>&#167;7.12. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Override with dynamic allocation schemata</span><span class="named-paragraph-number">7.12</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">TEST_ATOM_TASK</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"(RelationTest(%n,RELS_TEST,*1,*2))"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">RTRelations::iname</span><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_TRUE_TASK</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"(RelationTest(%n,RELS_ASSERT_TRUE,*1,*2))"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">RTRelations::iname</span><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">bp</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">task_functions</span><span class="plain-syntax">[</span><span class="identifier-syntax">NOW_ATOM_FALSE_TASK</span><span class="plain-syntax">] =</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Calculus::Schemas::new</span><span class="plain-syntax">(</span><span class="string-syntax">"(RelationTest(%n,RELS_ASSERT_FALSE,*1,*2))"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">RTRelations::iname</span><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">));</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-nrr.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. Storing relations.</b>At runtime, relation data is sometimes stored in a property, and that needs
to have a name:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="function-syntax">&lt;relation-storage-construction&gt;</span>
<span class="plain-syntax">    ... </span><span class="identifier-syntax">relation</span><span class="plain-syntax"> </span><span class="identifier-syntax">storage</span>
</pre>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. </b>A modest utility, to check for a case we forbid because of the prohibitive
(or anyway unpredictable) run-time storage it would imply.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">RelationRequests::check_finite_range</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">RelationRequests::check_finite_range</span></span>:<br/><a href="3-nrr.html#SP7_1_3">&#167;7.1.3</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">K</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Kinds::Behaviour::is_an_enumeration</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">K</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">; </span><span class="comment-syntax"> to recover from earlier problems</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Kinds::Behaviour::is_object</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">)) || (</span><span class="identifier-syntax">Kinds::Behaviour::definite</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">StandardProblems::sentence_problem</span><span class="plain-syntax">(</span><span class="identifier-syntax">Task::syntax_tree</span><span class="plain-syntax">(), </span><span class="identifier-syntax">_p_</span><span class="plain-syntax">(</span><span class="identifier-syntax">PM_RangeOverlyBroad</span><span class="plain-syntax">),</span>
<span class="plain-syntax">            </span><span class="string-syntax">"relations aren't allowed to range over all 'objects' or all 'values'"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="string-syntax">"as these are too broad. A relation has to be between two kinds of "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"object, or kinds of value. So 'Taming relates various people to "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"various animals' is fine, because 'people' and 'animals' both mean "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"kinds of object, but 'Wanting relates various objects to various "</span>
<span class="plain-syntax">            </span><span class="string-syntax">"values' is not allowed."</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. Registering names of relations.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="function-syntax">&lt;relation-name-formal&gt;</span>
<span class="plain-syntax">    ... </span><span class="identifier-syntax">relation</span>
</pre>
<p class="commentary firstcommentary"><a id="SP12" class="paragraph-anchor"></a><b>&#167;12. </b></p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">BINARY_PREDICATE_CREATED_CALCULUS_CALLBACK</span><span class="plain-syntax"> </span><a href="3-nrr.html#SP12" class="function-link"><span class="function-syntax">RelationRequests::register_name</span></a>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">RelationRequests::register_name</span><span class="plain-syntax">(</span><span class="identifier-syntax">binary_predicate</span><span class="plain-syntax"> *</span><span class="identifier-syntax">bp</span><span class="plain-syntax">, </span><span class="identifier-syntax">word_assemblage</span><span class="plain-syntax"> </span><span class="identifier-syntax">source_name</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">word_assemblage</span><span class="plain-syntax"> </span><span class="identifier-syntax">wa</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">PreformUtilities::merge</span><span class="plain-syntax">(</span><span class="function-syntax">&lt;relation-name-formal&gt;</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, </span><span class="identifier-syntax">source_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">wording</span><span class="plain-syntax"> </span><span class="identifier-syntax">AW</span><span class="plain-syntax"> = </span><span class="identifier-syntax">WordAssemblages::to_wording</span><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">wa</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Nouns::new_proper_noun</span><span class="plain-syntax">(</span><span class="identifier-syntax">AW</span><span class="plain-syntax">, </span><span class="identifier-syntax">NEUTER_GENDER</span><span class="plain-syntax">, </span><span class="identifier-syntax">ADD_TO_LEXICON_NTOPT</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">MISCELLANEOUS_MC</span><span class="plain-syntax">, </span><span class="identifier-syntax">Rvalues::from_binary_predicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">bp</span><span class="plain-syntax">), </span><span class="identifier-syntax">Task::language_of_syntax</span><span class="plain-syntax">());</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="3-nlpr.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-am.html">1</a></li><li class="progresschapter"><a href="2-bv.html">2</a></li><li class="progresscurrentchapter">3</li><li class="progresssection"><a href="3-dlr.html">dlr</a></li><li class="progresssection"><a href="3-pr.html">pr</a></li><li class="progresssection"><a href="3-tr.html">tr</a></li><li class="progresssection"><a href="3-nuor.html">nuor</a></li><li class="progresssection"><a href="3-uor.html">uor</a></li><li class="progresssection"><a href="3-tr2.html">tr2</a></li><li class="progresssection"><a href="3-dbtr.html">dbtr</a></li><li class="progresssection"><a href="3-rpr.html">rpr</a></li><li class="progresssection"><a href="3-nar.html">nar</a></li><li class="progresssection"><a href="3-nlpr.html">nlpr</a></li><li class="progresscurrent">nrr</li><li class="progresssection"><a href="3-npr.html">npr</a></li><li class="progresssection"><a href="3-nvr.html">nvr</a></li><li class="progresssection"><a href="3-nar2.html">nar2</a></li><li class="progresssection"><a href="3-ir.html">ir</a></li><li class="progresssection"><a href="3-ldr.html">ldr</a></li><li class="progresschapter"><a href="4-nr.html">4</a></li><li class="progresschapter"><a href="5-id.html">5</a></li><li class="progresschapter"><a href="6-rls.html">6</a></li><li class="progresschapter"><a href="7-tc.html">7</a></li><li class="progresschapter"><a href="8-kpr.html">8</a></li><li class="progressnext"><a href="3-npr.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

